import 'package:kepu/generated/json/base/json_convert_content.dart';
import 'package:kepu/model/game_entity.dart';

GameEntity $GameEntityFromJson(Map<String, dynamic> json) {
  final GameEntity gameEntity = GameEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    gameEntity.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    gameEntity.name = name;
  }
  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    gameEntity.image = image;
  }
  final bool? correct = jsonConvert.convert<bool>(json['correct']);
  if (correct != null) {
    gameEntity.correct = correct;
  }
  return gameEntity;
}

Map<String, dynamic> $GameEntityToJson(GameEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['image'] = entity.image;
  data['correct'] = entity.correct;
  return data;
}

extension GameEntityExtension on GameEntity {
  GameEntity copyWith({
    int? id,
    String? name,
    String? image,
    bool? correct,
  }) {
    return GameEntity()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..image = image ?? this.image
      ..correct = correct ?? this.correct;
  }
}